<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>文件上传</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <script type="text/javascript" th:src="@{/static/jquery-3.6.3.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/jquery-form.js}"></script>
</head>
<body>
<form id="import-file-form" action="/upload" method="post" enctype="multipart/form-data" target="form">
    <table>
        <tr>
            <td>请选择文件</td>
            <td><input type="file" name="muFile"></td>
        </tr>
        <tr>
            <td>请输入渠道</td>
            <td><input type="text" name="channel"></td>
        </tr>
        <tr>
            <td>请输入环境</td>
            <td><input type="text" name="env"></td>
        </tr>
        <tr>
            <td>请输入版本</td>
            <td><input type="text" name="version"></td>
        </tr>
        <tr>
            <td><input type="button" id="submit" value="上传" ></td>
        </tr>
    </table>
</form>
<script type="text/javascript">
    //注意：可兼容IE浏览器，推荐

    $("#submit").on("click",function(){
        $('#import-file-form').ajaxSubmit({
            dataType: 'json',
            beforeSerialize: function () {
                //此处可对参数进行处理
            },
            success: function (res) {
                alert(res.msg);
                $('#import-file-form')[0].reset();
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {},
            complete: function () {}
        });


    });
</script>
</body>
</html>
